package com.flying.flow.model;

import java.util.Date;

import com.flying.common.util.Codes;
import com.flying.framework.annotation.ConstantEnum;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Property;
import com.flying.framework.data.Data;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;

@SuppressWarnings("serial")
@Meta(id="f_flow",title="", table="f_flow", primaryKeys={"flow_id"})
public class Flow extends Data implements DataSerializable {
	public final static String ENTITY_NAME = "f_flow";
	
	public final static String SCOPE = "scope";
	public final static String ORG_CODE = "org_code";
	public final static String BUSINESS_TYPE = "business_type";
	public final static String CREATE_TIME = "create_time";
	public final static String CREATOR = "creator";
	public final static String CURRENT_FLOW_DEF = "current_flow_def";
	public final static String FLOW_ID = "flow_id";
	public final static String NAME = "name";
	public final static String REMARKS = "remarks";
	public final static String STATUS = "status";
	public final static String UPDATE_TIME = "update_time";
	public final static String UPDATOR = "updator";
	public final static String VERSION = "version";
	
	public enum FlowStatus implements ConstantEnum<Integer> {
		CREATING(0, "待发布"), PUBLISHED(8, "可发布"), INVALID(9, "已发布");
		
		public final int status;
		public final String remarks;
		
		FlowStatus(int status, String remarks) {
			this.status = status;
			this.remarks = remarks;
		}
		@Override
		public Integer value() {
			return status;
		}
		@Override
		public String text() {
			return remarks;
		}
	}
	
	public enum Scope implements ConstantEnum<Integer> {
		GLOBAL(0, "全局有效"), ORG(1, "机构专有");
		
		public final int status;
		public final String remarks;
		
		Scope(int status, String remarks) {
			this.status = status;
			this.remarks = remarks;
		}
		@Override
		public Integer value() {
			return status;
		}
		@Override
		public String text() {
			return remarks;
		}
	}
	
	@Param(value=ORG_CODE,   required=false,   maxlength=10,	desc="机构代码" )
	private String orgCode;
	
	@Param(value=BUSINESS_TYPE,   required=false,   maxlength=10,	desc="业务类型" )
	private String businessType;
	
	@Param(value=CREATE_TIME,   required=false,   maxlength=0,	desc="创建时间" )
	private Date createTime;
	
	@Param(value=CREATOR,   required=false,   maxlength=100,	desc="创建人" )
	private String creator;
	
	@Param(value=CURRENT_FLOW_DEF,   required=false,   maxlength=0,	desc="当前流程定义ID" )
	private Long currentFlowDef;
	
	@Param(value=FLOW_ID,   required=true,   maxlength=0,	desc="流程ID" , generator=Codes.AUTO_INCREMENT, 
			props= {@Property(name="type",value="hidden")})
	private Long flowId;
	
	@Param(value=NAME,   required=true,   maxlength=100,	desc="名称" )
	private String name;
	
	@Param(value=REMARKS,   required=false,   maxlength=1000,	desc="说明" )
	private String remarks;
	
	@Param(value="process_name",   ignored=true,   desc="绑定流程名称" )
	private String processName;
	
	@Param(value=STATUS,   required=false,   maxlength=0, enumClass=FlowStatus.class,	desc="状态" )
	private Integer status;
	
	@Param(value=SCOPE,   required=false,   maxlength=0, enumClass=Scope.class,	desc="范围" )
	private Integer scope;
	
	@Param(value=UPDATE_TIME,   required=false,   maxlength=0,	desc="修改时间" )
	private Date updateTime;
	
	@Param(value=UPDATOR,   required=false,   maxlength=100,	desc="修改人" )
	private String updator;
	
	@Param(value=VERSION,   required=false,   maxlength=0,	desc="当前版本" )
	private Integer version;
	
	public String getBusinessType() {
		return this.businessType;
	}
	
	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}
	
	public Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public String getCreator() {
		return this.creator;
	}
	
	public void setCreator(String creator) {
		this.creator = creator;
	}
	
	public Long getCurrentFlowDef() {
		return this.currentFlowDef;
	}
	
	public void setCurrentFlowDef(Long currentFlowDef) {
		this.currentFlowDef = currentFlowDef;
	}
	
	public Long getFlowId() {
		return this.flowId;
	}
	
	public void setFlowId(Long flowId) {
		this.flowId = flowId;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getRemarks() {
		return this.remarks;
	}
	
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	public Integer getStatus() {
		return this.status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public Date getUpdateTime() {
		return this.updateTime;
	}
	
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public String getUpdator() {
		return this.updator;
	}
	
	public void setUpdator(String updator) {
		this.updator = updator;
	}
	
	public Integer getVersion() {
		return this.version;
	}
	
	public void setVersion(Integer version) {
		this.version = version;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public Integer getScope() {
		return scope;
	}

	public void setScope(Integer scope) {
		this.scope = scope;
	}

	public String getProcessName() {
		return processName;
	}

	public void setProcessName(String processName) {
		this.processName = processName;
	}
	

}